class Solution {
public:
    int firstUniqChar(string s) {
        vector<int> find(26, 0);
        int n = s.size();
        for (int i : s)
            find[i - 'a']++;

        for (int i = 0; i < n; i++)
        {
            if (find[s[i] - 'a'] == 1)
                return i;
        }
        return -1;
    }
};